package TestCTR;

import org.junit.Test;
import java.util.ArrayList;

import CTRLayer.*;
import ModelLayer.*;

public class TestPersonCTR
{
	private PersonCTR pcc = new PersonCTR();
	private Person pc = new Person();

	@Test
	public void testFindAllPersons()
	{
		ArrayList<Person> pcclist = pcc.findAllPersons();
		int id = 0;
		System.out.println("\nAntal Person : " + pcclist.size());
		while (id <= pcclist.size())
		{
			System.out.println("Navn    : " + pcclist.get(id).getfName() + " " + pcclist.get(id).getlName());
			System.out.println("Adresse : " + pcclist.get(id).getAddress());
			System.out.println("Adresse : " + pcclist.get(id).getPostalCode() + " " + pcclist.get(id).getCity());
			System.out.println("Mobil   : " + pcclist.get(id).getMobileNr());
			System.out.println("Phone   : " + pcclist.get(id).getPhoneNr());
			System.out.println("Email   : " + pcclist.get(id).getEmail());
			System.out.println("----------------------------------");
			id++;
		}
		System.out.println("Next test\n");
	}

	@Test
	public void testFindPersonPhoneNr()
	{
		String phoneNr = "98235898";
		pc = pcc.findPersonPhoneNr(phoneNr);
		System.out.println("\ntestFindPersonPhoneNr");
		System.out.println("Navn    : " + pc.getfName() + " " + pc.getlName());
		System.out.println("Adresse : " + pc.getAddress());
		System.out.println("Adresse : " + pc.getPostalCode() + " " + pc.getCity());
		System.out.println("Mobil   : " + pc.getMobileNr());
		System.out.println("Phone   : " + pc.getPhoneNr());
		System.out.println("Email   : " + pc.getEmail());
		System.out.println("----------------------------------");
	}

	@Test
	public void testFindPersonMobileNr()
	{
		String mobileNr = "61276624";
		pc = pcc.findPersonMobileNr(mobileNr);
		System.out.println("\ntestFindPersonMobileNr");
		System.out.println("Navn    : " + pc.getfName() + " " + pc.getlName());
		System.out.println("Adresse : " + pc.getAddress());
		System.out.println("Adresse : " + pc.getPostalCode() + " " + pc.getCity());
		System.out.println("Mobil   : " + pc.getMobileNr());
		System.out.println("Phone   : " + pc.getPhoneNr());
		System.out.println("Email   : " + pc.getEmail());
		System.out.println("----------------------------------");
	}

}
